#include "mainwindow.h"
#include "ui_mainwindow.h"
void MainWindow::showMainwindow2()
{

  w2.show();
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //去掉最大化按钮、最小化按钮
    this->setWindowFlags(Qt::WindowCloseButtonHint);
    //
    button=new QPushButton(this);
    button->setGeometry(QRect(50,50,100,25));
    button->setText("按钮");
    //单击事件
    connect(button,SIGNAL(clicked()),this,SLOT(showMainwindow2()));
}

MainWindow::~MainWindow()
{
    delete ui;
}
